#pragma once
#include "online_manager.hpp"
#include "util.hpp"
typedef enum
{
    UNLOGIN,
    LOGIN
} ss_statu;

class session
{
private:
    uint64_t _ssid;//标识符
    uint64_t _uid;//session对应的用户ID
    ss_statu _statu;//用户状态 已登录 未登录
    websocket_server::timer_ptr _tp;//session关联的定时器
public:
    session(uint64_t ssid):_ssid(ssid)
    {
        DBG_LOG("SESSION %p 被创建!", this);
    }
    ~session()
    {
        DBG_LOG("SESSION %p 被释放!", this);
    }
    uint64_t ssid() { return _ssid; }
    uint64_t get_user() { return _uid; }
    void set_statu(ss_statu statu) { _statu = statu; }
    void set_user(uint64_t uid) { _uid = uid; }
    void set_timer(const websocket_server::timer_ptr &tp) { _tp = tp; }
    bool is_login() { return (_statu == LOGIN); }
    websocket_server::timer_ptr &get_timer() { return _tp; }
};